package com.apes.framework.plugin.workflow.domain;

import com.apes.framework.jpa.repository.CustomRepository;

import java.util.Date;
import java.util.List;
import org.springframework.data.repository.query.Param;
import org.springframework.data.jpa.repository.Query;

public interface CarbonCopyMessageRepository extends CustomRepository<CarbonCopyMessage, String> {


    List<CarbonCopyMessage> findAllByToTargetId(Integer userId);

    List<CarbonCopyMessage> findAllByToTargetIdAndCheckedIsFalse(Integer userId);

    List<CarbonCopyMessage> findAllBySourceBusinessKey(String businessKey);

    @Query("select T from CarbonCopyMessage T where T.createDate <= (sysdate - 7) and T.checked = 0")
    List<CarbonCopyMessage> findAllMoreSevenDayMessage();
}
